#! /usr/bin/octave -qf



1;

function [] = action(problem)

    if (problem == "ZDT1" || problem == "ZDT2" || problem == "ZDT3")
        printf("i'm here\n");
        real_pareto_front = generate_pareto_front(1000, 30, problem);

    elseif (problem == "ZDT4" || problem == "ZDT6")
        real_pareto_front = generate_pareto_front(1000, 10, problem);

    elseif (problem == "ZDT5")
        real_pareto_front = generate_pareto_front(31, 80, problem);
    endif


    __gnuplot_set__ term gif;

    set_plot_title = sprintf("__gnuplot_set__ title '%s';", problem);

    eval(set_plot_title);
   
    set_plot_output_file = sprintf("__gnuplot_set__ output '%s_plot.gif';", problem);

    eval(set_plot_output_file);

    x_real = real_pareto_front(:, 1);
    y_real = real_pareto_front(:, 2);

    xlabel("f_1");
    ylabel("f_2");


    if (problem == "ZDT5")
        plot_label_string = sprintf("+1;frente de Pareto;", problem);
        plot(x_real, y_real, plot_label_string);
    else
        plot_label_string = sprintf(".1;frente de Pareto;", problem);
        plot(x_real, y_real, plot_label_string);
    endif


endfunction

source("zdt.m");

action(argv{1});

